microbit = codesters.Microbit()
microbit.show_string("hello")
data = microbit.get_temp()
microbit.show_number(data)
data_list = []
time_list = []
my_display = codesters.ScatterPlot(time_list, data_list)
time = 0
def interval():
data = microbit.get_temp()
stage.event_interval(interval, 2)
t = codesters.Teacher()
appends = t.find_text('append')
try:
tval1 = appends[0][1]
tval2 = t.get_indent_at_line(appends[0][0])
except:
tval1 = "DNE"
tval2 = "DNE"
t1 = TestObjective()
t1.add_success('data_list.append(data)' in tval1 and tval2 == 4, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add an Append command to your interval event?")
t1.add_failure('data_list.' not in tval1, "Did you change the list name in the append command to data_list?")
t1.add_failure('(data)' not in tval1, "Did you change the variable in parentheses to data?")
t1.add_failure(tval2 < 4, "Make sure your Append command is indented INSIDE your interval event!")
t1.add_failure(tval2 > 4, "Make sure your Append command is indented ONLY 4 spaces inside your interval event.")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)